package pixeleditor.ctrl.impl;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.JRadioButton;

import common.ctrl.IObserver;
import common.gui.IViewable;

import pixeleditor.core.Board;
import pixeleditor.core.PaintSetup;

@SuppressWarnings("serial")
public class ChoosePlayerCtrl extends AbstractAction implements IObserver {

	@Override
	public void addView(IViewable iv) {
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		JRadioButton player1 = (JRadioButton) this.getValue("ChoosePlayerPanel.player1");
		Board.getInstance().getPaintSetup().setAddPlayer(player1.isSelected() ? PaintSetup.PLAYER1 : PaintSetup.PLAYER2);
	}
}
